﻿using Izhgtu.SandcastlePackage.DocumentReferenceItem;
using Microsoft.VisualStudio.Project;
using Microsoft.VisualStudio.Shell.Interop;

namespace Izhgtu.SandcastlePackage
{
	/// <summary>
	/// Reference container node for Sandcastle references.
	/// </summary>
	public class SandcastleReferenceContainerNode : ReferenceContainerNode
	{
        public SandcastleReferenceContainerNode(ProjectNode project)
			: base(project)
		{
		}


        public ReferenceNode CreateDocumentReferenceNode(VSCOMPONENTSELECTORDATA selectorData)
        {
            ReferenceNode node;


            node = new DocumentReferenceNode(this.ProjectMgr);

            return node;

        }


	    protected override ReferenceNode CreateReferenceNode(VSCOMPONENTSELECTORDATA selectorData, string wrapperTool = null)
        {
            ReferenceNode node = null;
            switch (selectorData.type)
            {
                case VSCOMPONENTTYPE.VSCOMPONENTTYPE_Project:
                    node = this.CreateProjectReferenceNode(selectorData);
                    break;
                case VSCOMPONENTTYPE.VSCOMPONENTTYPE_File:
                    ///node = this.CreateDocumentReferenceNode(selectorData);
                   /// break;
                case VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus:
                    node = this.CreateFileComponent(selectorData, wrapperTool);
                    break;
                case VSCOMPONENTTYPE.VSCOMPONENTTYPE_Com2:
                    node = this.CreateComReferenceNode(selectorData, wrapperTool);
                    break;
            }

            return node;
        }


		protected override ProjectReferenceNode CreateProjectReferenceNode(ProjectElement element)
		{
            return new SandcastleProjectReferenceNode(this.ProjectMgr, element);
		}

		protected override ProjectReferenceNode CreateProjectReferenceNode(VSCOMPONENTSELECTORDATA selectorData)
		{
            return new SandcastleProjectReferenceNode(this.ProjectMgr, selectorData.bstrTitle, selectorData.bstrFile, selectorData.bstrProjRef);
		}
	}
}
